package com.lefevre.cms.bean.statistic;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 页面访问量
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("pv")
@Entity
@Table(name = "pv", indexes = {@Index(name = "pv_1_idx", columnList = "times")})
public class PV implements Serializable {
    private static final long serialVersionUID = -8183252635387484081L;

    @Id
    @Column(length = 50)
    @TableId(type = IdType.INPUT)
    private String id;

    /**
     * 页面来源
     **/
    @Lob
    private String referrer;

    /**
     * 受访URL
     **/
    @Lob
    private String url;

    /**
     * IP
     **/
    @Column(length = 45)
    private String ip;

    /**
     * IP归属地
     **/
    @Transient
    @TableField(exist = false)
    private String ipAddress;

    /**
     * 访问时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    private Date times = new Date();

    /**
     * 浏览器名称
     **/
    private String browserName;

    /**
     * 访问设备系统
     **/
    private String operatingSystem;

    /**
     * 访问设备类型
     **/
    private String deviceType;

}
